<template>
	<view class="page-container order-track-container">
		<view class="item" v-for="(item, index) in list" :key="index">
			<view class="l-line" :style="{'--line-height':boxHeight+'px', '--line-bg': item.status == 1 ? '#FD5100' : '#EEEEEE' }">
				<view class="xian" v-if="index < list.length - 1"></view>
			</view>
			<view class="status">
				<view class="">
					<text>{{ item.type }}</text>
				</view>
				<view class="time">
					<text>{{item.time}}</text>
				</view>
			</view>
			<view class="info">
				<text>{{item.content}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				boxHeight: 0,
				recordLength: "",
				index: "",
				list: [{
					status: 1,
					type: "已完成",
					time: "2022-12-07 16:10",
					content: "感谢您对本次服务进行评价"
				}, {
					status: 1,
					type: "待评价",
					time: "2022-12-07 16:10",
					content: "订单已成功，请您对本次服务进行评价"
				}, {
					status: 1,
					type: "服务中",
					time: "2022-12-07 16:10",
					content: "服务人员正在为您服务"
				}, {
					status: 1,
					type: "已到达",
					time: "2022-12-07 16:10",
					content: "服务人员已到达，即将开始为您服务"
				}, {
					status: 1,
					type: "已接单",
					time: "2022-12-07 16:10",
					content: "服务人员已接单，会尽快与您电话联系确认订单"
				}, {
					status: 1,
					type: "等待接单中...",
					time: "2022-12-07 16:10",
					content: "请您耐心等待，我们尽快催促师傅接单"
				}, {
					status: 0,
					type: "订单已生成",
					time: "2022-12-07 16:10",
					content: "请您耐心等待，我们尽快催促师傅接单"
				}]
			}
		},
		mounted() {
			this.$nextTick(() => {
				const query = uni.createSelectorQuery().in(this);
				query
					.select(".item")
					.fields({
						size: true,
						scrollOffset: true,
					}, (data) => {
						this.boxHeight = data.height
					})
					.exec();
			})
		},
		methods: {

		}
	}
</script>

<style scoped lang="scss">
	.order-track-container {
		min-height: 100vh;
		background-color: #fff;
		padding: 32rpx 22rpx;
	}

	.item {
		padding-left: 64rpx;
		padding-bottom: 80rpx;
		position: relative;

		.l-line {
			position: absolute;
			width: 0rpx;
			left: 0;
			height: var(--line-height);

			.xian {
				width: 1rpx;
				height: var(--line-height);
				position: absolute;
				top: 34rpx;
				left: 17rpx;
				border-right: 2rpx dashed #999999;
			}

			&::after {
				content: '';
				width: 34rpx;
				height: 34rpx;
				background: var(--line-bg);
				border-radius: 50%;
				position: absolute;
				top: 9rpx;
				left: 0;
			}
		}

		.status {
			display: flex;
			align-items: center;
			font-weight: bold;
			font-size: 32rpx;
			color: #333333;
			
			.time {
				margin-left: 16rpx;
				font-weight: 400;
				font-size: 28rpx;
				color: #999999;
			}
		}

		.info {
			font-weight: 400;
			font-size: 30rpx;
			color: #333333;
			margin-top: 14rpx;
		}
	}
</style>